package com.order.mapper;

import com.order.entity.OrderDetail;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderDetailMapper {

    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    @Insert("insert into order_detail(order_id, product_id, name, image, quantity, amount)" +
            " VALUES " +
            "(#{orderId}, #{productId}, #{name}, #{image}, #{quantity}, #{amount})")
    void insert(OrderDetail orderDetail);
}
